<template>
  <div class="detail">
    <img src="@/assets/img/bg5.png" class="bg" />
    <!-- <vue-particles
      color="#9494FF"
      :particleOpacity="1"
      :particlesNumber="70"
      shapeType="circle"
      :particleSize="2"
      linesColor="#fff"
      :linesWidth="0"
      :lineLinked="false"
      :lineOpacity="0.4"
      :linesDistance="150"
      :moveSpeed="5"
      :hoverEffect="false"
      hoverMode="grab"
      :clickEffect="false"
      clickMode="push"
    >
    </vue-particles> -->
    <img src="@/assets/img/left.png" class="left" @click="toLeft()" />
    <div v-if="list.length > 3">
      <vue3-seamless-scroll
        :list="list"
        :hover="false"
        class="seamless-warp scroll"
        direction="left"
        v-model="scoll"
        :step="0.4"
      >
        <div class="list flex align">
          <div
            @click="toDetail(item)"
            class="item"
            v-for="(item, index) in list"
            :key="index"
          >
            <img src="@/assets/img/bg4.png" class="bg4" />
            <div class="title">{{name }}</div>
            <div class="content" v-html="item.description"></div>

            <!-- <div class="content">
              {{ item.description }}
            </div> -->
            <div class="imgs">
              <img
                :style="item.images.length > 2 ? 'width:100%' : 'width:100%'"
                :src="item2.url"
                v-for="(item2, index2) in item.images"
                :key="index2"
              />
            </div>
            <div
              class="content"
              v-if="item.description2 != ''"
              v-html="item.description2"
            ></div>
          </div>
        </div>
      </vue3-seamless-scroll>
    </div>
    <div class="list flex align list2" v-else>
      <div
        class="item"
        @click="toDetail(item)"
        v-for="(item, index) in list"
        :key="index"
      >
        <img src="@/assets/img/bg4.png" class="bg4" />
        <div class="title">{{ name }}</div>
        <div class="content" v-html="item.description"></div>
        <!-- <div class="content">
          {{ item.description }}
        </div> -->
        <div class="imgs">
          <img
            :style="item.images.length > 2 ? 'width:100%' : 'width:100%'"
            :src="item2.url"
            v-for="(item2, index2) in item.images"
            :key="index2"
          />
          <!-- @click="toPre(item2.url)" -->
        </div>
        <div
          class="content"
          v-if="item.description2 != ''"
          v-html="item.description2"
        ></div>
      </div>
    </div>
    <div class="showImg" v-if="showImg" @click="delImg()">
      <!-- <img :src="img" /> -->
      <div class="item">
        <img src="@/assets/img/bg4.png" class="bg4" />
        <div class="title">{{ name }}</div>
        <div class="content" v-html="infos.description"></div>

        <!-- <div class="content">
          {{ infos.description }}
        </div> -->
        <div class="imgs">
          <img
            :style="infos.images.length > 2 ? 'width:100%' : 'width:100%'"
            :src="item2.url"
            v-for="(item2, index2) in infos.images"
            :key="index2"
          />
          <!-- @click="toPre(item2.url)" -->
        </div>
        <div
          class="content"
          v-if="infos.description2 != ''"
          v-html="infos.description2"
        ></div>
      </div>
    </div>
  </div>
</template>
<script>
import { Vue3SeamlessScroll } from "vue3-seamless-scroll";
import { channel } from "@/api/apiData";
export default {
  components: { Vue3SeamlessScroll },
  data() {
    return {
      list: [],
      img: "",
      showImg: false,
      scoll: true,
      infos: "",
      name: "",
    };
  },
  mounted() {
    if (this.$route.query.name) {
      this.name = this.$route.query.name;
    }
    this.getDetail();
  },
  methods: {
    toLeft() {
      this.$router.go(-1);
    },
    getDetail() {
      let id = this.$route.query.id;
      channel.content.query({ channel_id: id }).then((res) => {
        if (res.code == 1) {
          if(id==101){
          this.list = res.data.list.reverse();

          }else{
          this.list = res.data.list;

          }
        }
      });
    },
    getAllList() {
      channel.content.query({ channel_id: 100 }).then((res) => {
        if (res.code == 1) {
          this.list = res.data.list;
        }
      });
    },
    toPre(img) {
      this.showImg = true;
      this.img = img;
      this.scoll = false;
    },
    toDetail(item) {
      this.showImg = true;
      this.scoll = false;
      this.infos = item;
    },
    delImg() {
      this.showImg = false;

      this.scoll = true;
    },
  },
};
</script>
<style lang="less" scoped>
.left {
  position: absolute;
  top: 50px;
  left: 40px;
  width: 71px;
  z-index: 20;
  cursor: pointer;
}
.detail {
  margin: 0 40px;
}
.showImg {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: rgba(0, 0, 0, 0.377);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  img {
    // width: 50%;
    display: block;
    max-height: 1000px;
  }
  .item {
    width: 600px;
    height: 800px;
    overflow: hidden;
    // color: white;
    margin: 0 25px;
    position: relative;
    .bg4 {
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      z-index: -1;
      position: absolute;
    }
    .title {
      padding: 24px 21px 43px;
      text-align: center;
      position: relative;
      font-weight: bold;
      font-size: 40px;
      color: white;
      text-align: right;
    }
    .content {
      padding: 20px 31px 0px 31px;
      font-size: 20px;
      position: relative;
      right: 11px;
    }
    .imgs {
      justify-content: space-between;
      width: 87%;
      margin: 10px auto;
      flex-wrap: wrap;
      position: relative;
      right: 20px;
      max-height: 499px;
      overflow: auto;
      img {
        // flex: 1;
        display: block;
        max-height: 400px;
        object-fit: cover;
      }
    }
  }
}
.list {
  margin: 194px 0px;
  position: relative;
  z-index: 2;
  .item {
    width: 400px;
    height: 693px;
    padding-bottom: 50px;
    overflow: hidden;
    // color: white;
    margin: 0 25px;
    position: relative;
    .bg4 {
      width: 100%;
      height: 100%;
      top: 0;
      left: 0;
      z-index: -1;
      position: absolute;
    }
    .title {
      padding: 24px 21px 43px;
      text-align: center;
      position: relative;
      font-weight: bold;
      font-size: 40px;
      color: white;
      text-align: right;
    }
    .content {
      padding: 10px 24px;
      font-size: 18px;
      position: relative;
      right: 6px;
    }
    .imgs {
      justify-content: space-between;
      width: 86%;
      margin: 10px auto;
      flex-wrap: wrap;
      position: relative;
      right: 11px;
      max-height: 369px;
      overflow: auto;
      img {
        // flex: 1;
        height: 200px;
        display: block;
        object-fit: cover;
      }
    }
  }
}
.list2 {
  justify-content: center;
  // .item{
  //   flex: 1;
  // }
}
.seamless-warp {
  //   height: 693px;
  overflow: hidden;
}
</style>
